/**
 * 接口集合
 * @version        $Id: interface.js
 * @package        jimmy.Adpositions
 * @copyright      Copyright (c) 2018 - 2020, jimmy, Inc.
 * @author         ye-shi-li@qq.com
 */
import axios from './api'
/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

// http请求接口
export const http = (url, data, method = 'post') => {
  return axios({
    url: url,
    method: method,
    data: data
  })
}

// 登录接口
export const login = (data) => {
  return axios({
    url: '/login/send',
    method: 'post',
    data: data
  })
}

// 菜单状态
export const menu = (data, action, method = 'post') => {
  return axios({
    url: '/menu/' + action,
    method: method,
    data: data
  })
}

// 系统基本接口
export const basic = (data, action, method = 'post') => {
  return axios({
    url: '/basic/' + action,
    method: method,
    data: data
  })
}

// 权限管理接口
export const role = (data, action, method = 'post') => {
  return axios({
    url: '/role/' + action,
    method: method,
    data: data
  })
}

// 系统用户接口
export const admin = (data, action, method = 'post') => {
  return axios({
    url: '/admin/' + action,
    method: method,
    data: data
  })
}

// 系统日记接口
export const logs = (data, action, method = 'post') => {
  return axios({
    url: '/logs/' + action,
    method: method,
    data: data
  })
}

// 默认全部导出
export default {
  http,
  login,
  menu,
  role,
  basic,
  logs,
  admin
}
